package com.prs.crm.action.hr;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.action.ReportAction;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.report.ExportConfig;
import com.prs.crm.report.ReportCell;
import com.prs.crm.report.ReportTable;

public class PersonReportAction extends ReportAction {

	private static final long serialVersionUID = 1L;

	

	@Action(value="personReport", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String reportPerson()
	{
		ReportTable table = new ReportTable("人员报表");
		table.addCell(new ReportCell("登录名","loginCode"));
		table.addCell(new ReportCell("真实姓名","resume.name"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(Person.class);
		//this.setOutFilePath(this.getReportService().reportPDF(criteria, table, new ExportConfig()));
		this.setOutFilePath(this.getReportService().reportExcel(criteria, table, new ExportConfig()));
		return SUCCESS;
	}
}
